<template>
	<view class="container">
		<view class="page-title">热门项目</view>
		<view class="list">
			<view class="item" v-for="(item,index) in shopList" :key="index" >
				<image :src="item.image" class="iamge" @click="goDetail(item.id)"></image>
				<view class="item-info" @click="goDetail(item.id)">
					<view class="name">{{item.name}}</view>
					<view class="remark">{{item.introduce}}</view>
					<view class="price"><text>¥</text>{{item.price}}</view>
					<view class="btn">{{item.detail}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		frontPage
	} from '@/api/product.js'
	export default {
		data() {
			return {
				shopList: [],
				pageLoadParam: {
					pageNum: 1,
					pageSize: 20,
					type: 7,
					shopId:''
				},
			};
		},
		onLoad(option) {
				if (option.shopId) {
					this.pageLoadParam.shopId=option.shopId
				}
			this.getList()
		},
		methods: {
			getList(){
				frontPage(this.pageLoadParam).then(respanse => {
					this.shopList = respanse.result.rows
				})
			},
			goDetail(productId){
				uni.navigateTo({
							    url: '/pages/product-details/productdetail?productId='+productId
							});
			},
			radioChange(evt) {
				console.log(evt)
				this.form.current = evt.detail.value
			},
			submit() {
				// if(!this.form.)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		padding:0 32rpx 32rpx;

		.page-title{
			margin-top: 22rpx;
			padding: 8rpx 0;
			font-size: 32rpx;
			color: #151B33;
			line-height: 42rpx;
			font-weight: bold;
			position: relative;
			&::after{
				content: '';
				position: absolute;
				left: 48rpx;
				bottom: 6rpx;
				width: 34rpx;
				height: 16rpx;
				background: url(@/static/Vector@2x.png) bottom center no-repeat;
				background-size: contain;
			}
		}
		.list{
			.item{
				padding: 30rpx 24rpx;
				margin-top: 20rpx;
				display: flex;
				background-color: #fff;
				border-radius: 16rpx;
				.iamge{
					width: 168rpx;
					height: 168rpx;
					border-radius: 16rpx;
					min-width: 0;
				}
				.item-info{
					flex: 1;
					position: relative;
					margin-left: 24rpx;
					.name{
						font-size: 28rpx;
						font-weight: 600;
						color: #151B33;
						line-height: 36rpx;
					}
					.remark{
						margin-top: 12rpx;
						font-size: 24rpx;
						font-family: PingFang SC-Regular, PingFang SC;
						font-weight: 400;
						color: #999999;
						line-height: 28rpx;
						overflow: hidden;
						text-overflow: ellipsis;
						-webkit-line-clamp: 2;
						display: -webkit-box;
						-webkit-box-orient: vertical;
					}
					.price{
						position: absolute;
						bottom: 2rpx;
						right: 0;
						font-size: 38rpx;
						font-family: DM Sans-Bold, DM Sans;
						font-weight: bold;
						color: #FF4747;
						line-height: 38rpx;
						text{
							font-size: 24rpx;
						}
					}
					.btn{
						position: absolute;
						right: 0;
						bottom: 2rpx;
						background: #E96431;
						line-height: 52rpx;
						font-size: 24rpx;
						font-weight: 400;
						color: #FFFFFF;
						padding: 0 24rpx;
						border-radius: 50rpx;
					}
				}
			}
		}
	}
</style>